//
//  ZWLAnimViewController.swift
//  ZWLDY
//
//  Created by zwl on 2016/10/16.
//  Copyright © 2016年 zwl. All rights reserved.
//

import UIKit

class ZWLAnimViewController: UIViewController {
    
    // 属性
    var contentView : UIView?
    lazy var imageView : UIImageView = {
        let imageView = UIImageView(image: UIImage(named: "img_loading_1"))
        imageView.center = self.view.center
        imageView.animationImages = [UIImage(named: "img_loading_1")!, UIImage(named: "img_loading_2")!]
        imageView.animationRepeatCount = LONG_MAX
        imageView.animationDuration = 0.3
        imageView.autoresizingMask = [.flexibleBottomMargin, .flexibleTopMargin]
        return imageView
    }()
    

    override func viewDidLoad() {
        super.viewDidLoad()

    }
}

extension ZWLAnimViewController {
    func setupUI() {
        view.backgroundColor = UIColor(r: 250, g: 250, b: 250)
        view.addSubview(imageView)
        imageView.startAnimating()
        contentView?.isHidden = true
    }
    
    func loadDataFinished() {
        imageView.stopAnimating()
        imageView.isHidden = true
        contentView?.isHidden = false
    }
}
